﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Agro.Models;
using Agro.Library;
using System.Data;
using SN.Core;
using SN.Data;
using System.IO;

namespace Agro.Services {
    public interface IReportService : IBaseService {

        IList<T_Organization> GetChildOrg(string orgid);

        T_Report GetReportProperty(string reportid);
        string GetReprotFormat(int submitInfoId, CurrentUser user);

        int SaveZBSJ(T_ZBSJ zbsj, CurrentUser user);

        DataTable ReportGetList(QueryBase query, WhereClip wclip);

        int updateState(string SubmitInfoId, string state, CurrentUser user, out string msg);
        DataTable ReprotList(QueryBase query, WhereClip wclip); //得到报表数据
        string PublishReport(string OrgIds, string ReportIds,
            string Year, string Month, string Jd, int userId, string realName);


        //#region 改成按年进行报表的下发 Modified 2013-06-21
        //string PublishReport(string ReportIds, string Year);
        //#endregion

        /// <summary>
        /// 计算公式指标的值
        /// </summary>
        /// <param name="reportId"></param>
        /// <param name="dwid"></param>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <param name="day"></param>
        /// <param name="cycle"></param>
        /// <returns></returns>
        void CalcFormulaZBValue(int submitInfoId, CurrentUser user);

        /// <summary>
        /// 汇总报表 (上级汇总下级)
        /// </summary>
        string CollectReport(string reportId, string dwid, string year, string month,string jd, string day, CurrentUser currUser, string org);

        /// <summary>
        /// 保存年收入5000W以上的报表
        /// </summary>
        /// <param name="dataList"></param>
        /// <param name="msg"></param>
        void Save5000WReport(List<T_5000W> dataList, out string msg);


        DataTable Get5000WReportDT(WhereClip where, QueryBase query);


        /// <summary>
        /// 暂定方法名，导出Excel
        /// </summary>
        /// <param name="reportId"></param>
        /// <param name="dwid"></param>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <param name="day"></param>
        /// <param name="cycle"></param>
        System.IO.MemoryStream GetExcelStream(string SubmitInfoId, CurrentUser CurrUser, out string msg);
        /// <summary>
        /// 报表数据的删除
        /// </summary>
        /// <param name="id"></param>
        /// <param name="Msg"></param>
        /// <returns></returns>
        string DeleteSubmitInfo(string id, CurrentUser User, out string Msg);

        /// <summary>
        /// 校验指标数据
        /// </summary>
        /// <param name="submitInfoId"></param>
        /// <param name="errorList"></param>
        /// <returns></returns>
        List<KeyValuePair<string, string>> CheckZBValue(string submitInfoId, out List<string> errorList);

        MemoryStream Get5000WReportStream(int submitInfoID);


        void SetLazyDate(CurrentUser CurrUser, int submitInfoID, DateTime dtLazyDate, out string msg);

        /// <summary>
        /// 报表数据导入
        /// </summary>
        /// <param name="stream">导入的文件</param>
        /// <param name="submitInfoId">下发报表id</param>
        /// <returns></returns>
        string importReport(MemoryStream stream, string submitInfoId);


        /// <summary>
        /// 报表数据导入(用于导入非模版类报表，如年营业收入5000万元以上农产品加工企业一览表等)
        /// </summary>
        /// <param name="stream">导入的文件</param>
        /// <param name="submitInfoId">下发报表id</param>
        ///  <param name="colModels">列名</param>
        /// <returns></returns>
        DataTable importReportExA(MemoryStream stream, string submitInfoId, string colModels);

        /// <summary>
        /// 河南农业产业化龙头企业季报表导入，因为表头比较特殊，显示字段名称相同，用通用的方法无法处理此方法直接按数据在表格中的位置导入，不判断列是否一致
        /// </summary>
        /// <param name="stream">导入的文件</param>
        /// <param name="submitInfoId">下发报表id</param>
        ///  <param name="colModels">列名</param>
        /// <returns></returns>
        DataTable importReportExB(MemoryStream stream, string submitInfoId, string colModels);

        DataTable GetXXNYQYJBDT(WhereClip where, QueryBase query);

        void SaveXXNYQYJB(List<T_XXNYQYJB> dataList, out string msg);

        MemoryStream GetXXNYQYJBStream(int submitInfoID);

        /// <summary>
        /// 保存农业产业化龙头企业年报
        /// </summary>
        /// <param name="dataList"></param>
        /// <param name="msg"></param>
        void SaveNYCYHLTQYNB(T_NYCYHLTQYNB model, out string msg);

        DataSet ImportLTQYNB(MemoryStream stream, string submitInfoId,
            string colModel1,
            string colModel2,
            string colModel3,
            string colModel4,
            string colModel5,
            string colModel6,
            string colModel7,
            out string msg);

        #region 农业产业化龙头企业季报
        DataTable GetNYCYHLTQYJBDT(WhereClip where, QueryBase query);

        void SaveNYCYHLTQYJB(List<T_NYCYHLTQYJB> dataList, out string msg);

        MemoryStream GetNYCYHLTQYJBStream(int submitInfoID, string Organization_Level);

        #endregion

        #region 龙头企业年报...
        MemoryStream GetNYCYHLTQYNBStream(int submitInfoID, string Organization_Level);
        #endregion

        DataTable GetReportNameList(CurrentUser user);

        DataTable GetReportStateList(QueryBase query, string wclip,string wSubmitinfoclip,string reportid);

        

    }
}
